#define _CRT_SECURE_NO_WARNINGS 1



struct ListNode {
     int val;
     struct ListNode *next;
 };
 
struct ListNode* middleNode(struct ListNode* head)
{
    struct ListNode* cur = head;
    while (cur->next)
    {
        cur = cur->next;
    }
    int n = (cur->val) / 2;
    struct ListNode* num = head;
    while (n)
    {
        num = num->next;
        n--;
    }
    return num;
}

struct ListNode* middleNode(struct ListNode* head)
{
    struct ListNode* show = head;
    struct ListNode* fast = head;
    while (fast && fast->next)
    {
        show = show->next;
        fast = fast->next->next;
    }
    return show;
}